home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / JWindow.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  3.5 KB  |  134 lines

  1. package javax.swing;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.Frame;
  6. import java.awt.LayoutManager;
  7. import java.awt.Window;
  8. import javax.accessibility.Accessible;
  9. import javax.accessibility.AccessibleContext;
  10.  
  11. public class JWindow extends Window implements Accessible, RootPaneContainer {
  12.    protected JRootPane rootPane;
  13.    protected boolean rootPaneCheckingEnabled;
  14.    protected AccessibleContext accessibleContext;
  15.  
  16.    public JWindow() {
  17.       this((Frame)null);
  18.    }
  19.  
  20.    public JWindow(Frame var1) {
  21.       super(var1 == null ? SwingUtilities.getSharedOwnerFrame() : var1);
  22.       this.rootPaneCheckingEnabled = false;
  23.       this.accessibleContext = null;
  24.       this.windowInit();
  25.    }
  26.  
  27.    protected void addImpl(Component var1, Object var2, int var3) {
  28.       if (this.isRootPaneCheckingEnabled()) {
  29.          throw this.createRootPaneException("add");
  30.       } else {
  31.          super.addImpl(var1, var2, var3);
  32.       }
  33.    }
  34.  
  35.    protected JRootPane createRootPane() {
  36.       return new JRootPane();
  37.    }
  38.  
  39.    private Error createRootPaneException(String var1) {
  40.       String var2 = this.getClass().getName();
  41.       return new Error("Do not use " + var2 + "." + var1 + "() use " + var2 + ".getContentPane()." + var1 + "() instead");
  42.    }
  43.  
  44.    public AccessibleContext getAccessibleContext() {
  45.       if (this.accessibleContext == null) {
  46.          this.accessibleContext = new AccessibleJWindow(this);
  47.       }
  48.  
  49.       return this.accessibleContext;
  50.    }
  51.  
  52.    public Container getContentPane() {
  53.       return this.getRootPane().getContentPane();
  54.    }
  55.  
  56.    public Component getGlassPane() {
  57.       return this.getRootPane().getGlassPane();
  58.    }
  59.  
  60.    public JLayeredPane getLayeredPane() {
  61.       return this.getRootPane().getLayeredPane();
  62.    }
  63.  
  64.    public JRootPane getRootPane() {
  65.       return this.rootPane;
  66.    }
  67.  
  68.    protected boolean isRootPaneCheckingEnabled() {
  69.       return this.rootPaneCheckingEnabled;
  70.    }
  71.  
  72.    protected String paramString() {
  73.       String var1 = this.rootPaneCheckingEnabled ? "true" : "false";
  74.       return super.paramString() + ",rootPaneCheckingEnabled=" + var1;
  75.    }
  76.  
  77.    public void remove(Component var1) {
  78.       if (var1 == this.rootPane) {
  79.          super.remove(var1);
  80.       } else {
  81.          this.getContentPane().remove(var1);
  82.       }
  83.  
  84.    }
  85.  
  86.    public void setContentPane(Container var1) {
  87.       this.getRootPane().setContentPane(var1);
  88.    }
  89.  
  90.    public void setGlassPane(Component var1) {
  91.       this.getRootPane().setGlassPane(var1);
  92.    }
  93.  
  94.    public void setLayeredPane(JLayeredPane var1) {
  95.       this.getRootPane().setLayeredPane(var1);
  96.    }
  97.  
  98.    public void setLayout(LayoutManager var1) {
  99.       if (this.isRootPaneCheckingEnabled()) {
  100.          throw this.createRootPaneException("setLayout");
  101.       } else {
  102.          super.setLayout(var1);
  103.       }
  104.    }
  105.  
  106.    protected void setRootPane(JRootPane var1) {
  107.       if (this.rootPane != null) {
  108.          this.remove(this.rootPane);
  109.       }
  110.  
  111.       this.rootPane = var1;
  112.       if (this.rootPane != null) {
  113.          boolean var2 = this.isRootPaneCheckingEnabled();
  114.  
  115.          try {
  116.             this.setRootPaneCheckingEnabled(false);
  117.             ((Container)this).add(this.rootPane, "Center");
  118.          } finally {
  119.             this.setRootPaneCheckingEnabled(var2);
  120.          }
  121.       }
  122.  
  123.    }
  124.  
  125.    protected void setRootPaneCheckingEnabled(boolean var1) {
  126.       this.rootPaneCheckingEnabled = var1;
  127.    }
  128.  
  129.    protected void windowInit() {
  130.       this.setRootPane(this.createRootPane());
  131.       this.setRootPaneCheckingEnabled(true);
  132.    }
  133. }
  134.